1. Technical Field
The present invention is directed generally toward improved data storage. More particularly, the present invention relates to a method and apparatus in a data controller for retrieving, evaluating, and processing a context that describes a direct memory access request and includes a skip mask table.
2. Description of the Related Art
One function of a data processing system is to move data based on a request from an external system. For efficient operation, it is important that the data processing system maintain data movement between a requestor and a final storage medium without excessive processing overhead, whether the final storage medium is a disk drive, cd-rom drive, tape drive, flash memory or the like.
There are many approaches to controlling the movement of data based on a request from an external system. One approach is to use a microprocessor to process every boundary in the data flow via service interrupts. For example, when a request is made, an interrupt can be asserted to communicate to the microprocessor that a new command is available. The microprocessor can then evaluate the command and determine the size of the data transaction. If the request is a write command, the microprocessor allocates space to store the data, in either an internal or an external storage medium, and then processes the incoming data. A similar process is followed to read data from a storage medium in response to a read command.
Data may be moved between a requesting host device and a storage device using direct memory access (DMA). Direct memory access uses specialized circuitry or a dedicated microprocessor to transfer data from memory to memory. For example, data may be moved from a buffer in a host bus adapter to a buffer in the storage device. The characteristics of a DMA transfer are typically defined using a context, which includes all of the information that is necessary in order for a storage controller included in the storage device to program a DMA transfer, whether that transfer is a read or a write. A context typically describes whether the transfer is to be a read or write to the drive, the length of the data to be transferred, and the current location of the data to be read or the space in the buffer where the data is to be written. The context can also specify to release some of the data in the buffer in the storage device for reads before starting to transfer data. This is useful in case the DMA request skips a small amount of data between two commands. In this case, the DMA can transfer the data for the first command represented by a first context, then jump over the data to be skipped based on a release count in the second context, then transfer the data for the second command represented by the second context.
In some implementations, a host device may wish to perform a read from or a write to non-consecutive locations. For example, a host device may write video data that is to be interleaved with audio data. For this purpose, a DMA request may also include a skip mask, also referred to as a skip mask table. A skip mask table is a series of ones and zeroes that indicate whether consecutive memory addresses or data locations, also referred to as logical blocks or sectors, are to be transferred. The target device may use this table to determine which locations are valid and which locations need to be skipped. The microprocessor of the storage controller must then create separate contexts for each group of valid locations based on the skip mask table. The storage controller must then manage a list of contexts that is different from the contexts received from the host device.
As an example, consider a table that includes 2048 bits. A DMA request from a host device may indicate to write 1024 sectors of data with a skip mask table of 256 bytes, where each byte has the following binary bit-pattern: “10101010.” In this example, the storage controller must create 1024 separate contexts that transfer one sector each. This is a worst-case scenario, but it illustrates the inefficiency of using the microprocessor resources at the storage controller to create a list of contexts based on the skip mask table.